"""
URL configuration for test_back project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include,re_path
from django.views.static import serve
from rest_framework.documentation import include_docs_urls
from rest_framework.schemas import get_schema_view
from rest_framework_swagger.renderers import SwaggerUIRenderer,OpenAPICodec
from .settings import MEDIA_ROOT,STATIC_ROOT
from . import views


schema_view=get_schema_view(title='我的商城文档接口-swagger',renderer_classes=[SwaggerUIRenderer,OpenAPICodec])


urlpatterns = [
    #默认的路由文件
    path('admin/', admin.site.urls),


    #应用的路由文件
    path('', include('apps.videos.urls')),
    path('', include('apps.users.urls')),

    # 后台的路由文件
    path('basic/', include('apps.basic.urls')),
    path('users/', include('apps.users.back_urls')),
    path('videos/', include('apps.videos.back_urls')),
    path('ckeditor/', include('ckeditor_uploader.urls')),

    #api的路由文件
    path('', include('apps.videos.api_urls')),

    #接口文档
    path('docs/', include_docs_urls('我的商城文档接口-coreapi')),
    path('docs1/', schema_view),

    #生产模式中的静态和媒体的路由
    re_path('static/(?P<path>.*)', serve, {"document_root": STATIC_ROOT}),
    re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}),
]
